package cn.edu.hznu.mybatis.sqlsession;

import cn.edu.hznu.mybatis.config.Configuration;
import cn.edu.hznu.mybatis.sqlsession.impl.SqlSessionFactoryImpl;
import cn.edu.hznu.mybatis.utils.XMLConfigBuilder;

import java.io.InputStream;

/**
 * Created by wjj on 2020/5/25
 * 构建者模式，用于创建SqlSessionFactory对象
 */
public class SqlSessionFactoryBuilder {
    public SqlSessionFactory build(InputStream config){
        Configuration cfg= XMLConfigBuilder.loadConfiguration(config);
        return new SqlSessionFactoryImpl(cfg);
    }
}
